/*	$Id: stat.h 983 2009-09-01 02:45:42Z phrakt $ */
/*
 * Copyright (c) 2003 Jean-Francois Brousseau <phrakt@gmail.com>
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
 * THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */


#ifndef _HTTP_STAT_H_
#define _HTTP_STAT_H_


/* status codes */
#define HTTP_STAT_CONTINUE        100
#define HTTP_STAT_SWITCHPROTO     101

#define HTTP_STAT_OK              200
#define HTTP_STAT_CREATED         201
#define HTTP_STAT_ACCEPTED        202
#define HTTP_STAT_NONAUTHINFO     203
#define HTTP_STAT_NOCONTENT       204
#define HTTP_STAT_RESETCONT       205
#define HTTP_STAT_PARTIALCONT     206

#define HTTP_STAT_MULTCHOICES     300
#define HTTP_STAT_MOVEDPERM       301
#define HTTP_STAT_FOUND           302
#define HTTP_STAT_SEEOTHER        303
#define HTTP_STAT_NOTMODIFIED     304
#define HTTP_STAT_USEPROXY        305
#define HTTP_STAT_UNUSED          306
#define HTTP_STAT_TEMPREDIRECT    307

#define HTTP_STAT_BADREQUEST      400
#define HTTP_STAT_UNAUTH          401
#define HTTP_STAT_PAYMENTREQ      402
#define HTTP_STAT_FORBIDDEN       403
#define HTTP_STAT_NOTFOUND        404
#define HTTP_STAT_NOTALLOWED      405
#define HTTP_STAT_NOTACCEPT       406
#define HTTP_STAT_PROXYAUTH       407
#define HTTP_STAT_REQTIMEOUT      408
#define HTTP_STAT_CONFLICT        409
#define HTTP_STAT_GONE            410
#define HTTP_STAT_LENGTHREQ       411
#define HTTP_STAT_PRECOND         412
#define HTTP_STAT_ENTTOOLARGE     413
#define HTTP_STAT_URITOOLONG      414
#define HTTP_STAT_UNSUPMEDIA      415
#define HTTP_STAT_REQRANGE        416
#define HTTP_STAT_EXPECT          417

#define HTTP_STAT_INTERNALERR     500
#define HTTP_STAT_NOTIMPL         501
#define HTTP_STAT_BADGATEWAY      502
#define HTTP_STAT_UNAVAILABLE     503
#define HTTP_STAT_GTWTIMEOUT      504
#define HTTP_STAT_HTTPVERSION     505


#define http_stat_issuccess(s)		(((s) / 100) < 3)


/* status code structure */
struct http_code {
	int                 hc_val;
	char                hc_desc[32];
	struct http_entity *hc_ent;
};


const char* http_status_getdesc(int);

#endif /* _HTTP_STAT_H_ */
